<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>信息后台管理系统</title>
		<link rel="shortcut icon" href="${request.contextPath}/bootstrap/img/loading.gif">
		<link rel="stylesheet" type="text/css" href="${request.contextPath}/res/jquery-easyui-1.3.6/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="${request.contextPath}/res/jquery-easyui-1.3.6/themes/icon.css">
		<script type="text/javascript" src="${request.contextPath}/res/jquery-easyui-1.3.6/jquery-1.11.1.js"></script>
		<script type="text/javascript" src="${request.contextPath}/res/jquery-easyui-1.3.6/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="${request.contextPath}/res/jquery-easyui-1.3.6/locale/easyui-lang-zh_CN.js"></script>
		<script src="${request.contextPath}/res/jquery-easyui-1.3.6/users.js" type="text/javascript" charset="utf-8"></script>
		<script src="${request.contextPath}/res/jquery-easyui-1.3.6/jquery.rotate.min.js" type="text/javascript" charset="utf-8"></script>
		<style>
			._label{  
			    display: inline-block;  
			    vertical-align: middle;  
			    height: 20px;
			    line-height: 20px;
			}
			
			.show{
		font-size: 16px;
		width: 1450px;
		margin: 20px auto;
	}
	.show table{
		border-collapse: collapse;
		border: none;
		width: 1450px;
	}
	.show table td{
		padding: 5px;
		border: 1px solid #CCCCCC;
	}
	.show table td input[type=text]{
		width: 200px;
	}
	
	.show table td img{
		 margin: 5px
	}
	
	.show table td input[type=button]{
		font-size: 20px;
		cursor: pointer;
		background: #F05E0F;
		border: none;
		width: 150px;
		height: 30px;
	}
		</style>

		<script>
			
		</script>
	</head>

	<body id="body" class="easyui-layout" style="width: 100%; height: 100%;" scroll="no">
		<input type="hidden" id="sys_admin" value="${sysAdmin.nickname}" />
		<!-- 头部 -->
		<div data-options="region:'north',border:false, collapsible:false" title="客户注册信息" style="border: 0px red solid; overflow: hidden;">
			<div id="tbn" style="padding:5px; height:auto, vertical-align: middle; font-size:16px; height: 60px;">
				<#if sysAdmin.nickname == "admin">
				<span class="_label">所属会员:</span>
				<select id="q_member" class="easyui-combobox" name="member" style="width: 150px;">
					<option value="-1" selected="selected">全部</option>
					<#list memberMap?keys as key> 
	                    <option value="${key}">${key}</option>
	                </#list>
				</select>
				</#if>
				
				<span class="_label">状态:</span>
				<select id="q_status" class="easyui-combobox" style="height:25px;">
					<option value="-1">全部</option>
					<#if sysAdmin.nickname == "admin">
						<option value="0" >待审核</option>
						<option value="1" selected="selected">已审核(会员单位)</option>
					<#else>
						<option value="0" selected="selected">待审核</option>
						<option value="1" >已审核(会员单位)</option>
					</#if>
					<option value="2">已审核(交易中心)</option>
					<option value="3">已入金激活</option>
				</select>
				<span class="_label">开始时间:</span>
				<input id="q_startDate" class="easyui-datetimebox" editable="false" name="startDate" value="2016-01-01 00:00:00" style="width:150px;height:25px;">
				<span class="_label">结束时间:</span>
				<input id="q_endDate" class="easyui-datetimebox" editable="false" name="endDate" value="${.now?datetime}" style="width:150px;height:25px;">
				<div style="display: inline-block; margin-left: 5px; padding-left: 10px; border-left: 1px solid #CCCCCC;">
					<span class="_label">名字:</span>
					<input id="q_name" name="name" style="width:100px; height: 23px;">
					<span class="_label">账号:</span>
					<input id="q_number" name="number" style="width:150px; height: 23px;">
					<#if sysAdmin.nickname != "admin">
					<span class="_label">推荐人:</span>
					<select id="q_code" class="easyui-combobox" panelHeight="auto" style="width:100px;height:25px;">
						<option value="-1" selected="selected">全部</option>
						<#list q_codes as myCode>
							<option value="${myCode.code}">${myCode.name}</option>
						</#list>
					</select>
					</#if>
					<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="javascript:queryUserData();">搜索</a>
				</div>
				
				<div style="display: inline-block; margin-left: 5px; padding-left: 10px; border-left: 1px solid #CCCCCC;">
					<a href="#" class="easyui-linkbutton" iconCls="icon-cut" onclick="javascript:deleteUserInfo();">删除</a>
				</div>
			</div>
		</div>
		<!-- 头部  end -->

		<div data-options="region:'center'">
			<table id="datagrid" style="width:auto" 
			data-options="url:'users/query', 
			method:'post', 
			<#if sysAdmin.nickname != "admin">
				queryParams:{'status':0},
			<#else>
				queryParams:{'status':1},
			</#if>
			rownumbers:true, fit:true, fitColumns:true, pagination:true, singleSelect:true, showFooter:true, striped:true,toolbar:'#tb'">
				<thead>
					<tr>
						<th data-options="field:'id',width:120, formatter:formatterID">操作</th>
						<th data-options="field:'status',width:150, align:'center', formatter:formatterStatus">状态</th>
						<th data-options="field:'name',width:80, align:'center'">姓名</th>
						<th data-options="field:'gender',width:40, align:'center'">性别</th>
						<th data-options="field:'age',width:40, align:'center'">年龄</th>
						<th data-options="field:'member',width:80, align:'center'">所属会员</th>
						<th data-options="field:'referral',width:100, align:'center'">推荐人</th>
						<th data-options="field:'number',width:120">交易账号</th>
						<th data-options="field:'amount',width:60">是否提货</th>
						<th data-options="field:'cid',width:150">身份证号</th>
						<th data-options="field:'email',width:140">邮箱</th>
						<th data-options="field:'phone',width:100">电话</th>
						<th data-options="field:'province',width:80">省份</th>
						<th data-options="field:'bank',width:100">银行名称</th>
						<th data-options="field:'card',width:120">银行卡号</th>
						<th data-options="field:'address',width:180">地址</th>
						<th data-options="field:'rdate',width:150">注册时间</th>
						<th data-options="field:'remark',width:220">备注</th>
						<th data-options="field:'sfz1', hidden:true">身份证正面</th>
						<th data-options="field:'sfz2', hidden:true">身份证反面</th>
						<th data-options="field:'sfz3', hidden:true">身份证手持</th>
					</tr>
				</thead>
			</table>
		</div>

		<!-- 展示客户注册信息，进行审核 -->
		<div id="win" class="easyui-window" title="模态窗口" data-options="modal:true,closed:true,iconCls:'icon-save', resizable:false, collapsible:false, minimizable:false, maximizable:true" style="width:800px;height:600px;padding:10px;">
			<div id="show_box" class="show">
				<table>
					<tr>
						<td>
							姓名：<b id="name"></b>
						</td>
						<td>
							性别：<b id="sex"></b>
						</td>
						<td>
							年龄：<b id="age"></b>岁
						</td>
					</tr>
					<tr>
						<td>
							电话：<b id="phone"></b>
						</td>
						<td>
							邮箱：<b id="email"></b>
						</td>
						<td>
							省份：<b id="province"></b>
						</td>
					</tr>
					<tr>
						<td colspan="3">
							身份证号：<b id="cid"></b>
						</td>
					</tr>
					<tr>
						<td colspan="3">
							<img id="sfz_1" src="" width="450" style="float: left;" />
							<img id="sfz_2" src="" width="450" style="float: left;" />
							<img id="sfz_3" src="" width="450" style="float: left;" />
						</td>
					</tr>
					<tr>
						<td colspan="3">
							地址：<b id="address"></b>
						</td>
					</tr>
					<tr>
						<td>
							银行名称：<b id="bank"></b>
						</td>
						<td colspan="3">
							银行卡号：<b id="card"></b>
						</td>
					</tr>
					<tr>
						<td colspan="1">
							生成账户：
							<input type="hidden" id="id" value="1" />
							<input type="text" id="number" name="number" />
						</td>
						<td style="text-align: center; height: 40px;">
							<#if sysAdmin.nickname != "admin">
								<input type="button" value="提交" title="点击提交创建的交易账号" onclick="submitNumber()" style="background-color: green; color: #fff;" /> 
							<#else>
								<input type="button" id="approve_btn" value="通过" title="点击审核通过" onclick="approve();" style="background-color: green; color: #fff;" /> 	
							</#if>
						</td>
						
						<td style="text-align: center; height: 40px;">
							<input type="button" value="未通过" title="点击激活，系统将在同一时间发生邮件通知客户和会员单位" onclick="openSendMsgDialog()" />
						</td>
					</tr>
				</table>
			</div>
		</div>
		<!-- 展示客户注册信息，进行审核 ***********结束 -->
		
		
		<!-- 打开发送未通过消息对话框  -->
		<div id="sendMsgDialog" class="easyui-dialog" title="未通过审核的原因" style="width:500px;height:340px; padding: 5px;" data-options="iconCls:'icon-save',closed:true,closable:true,
	        resizable:true,modal:true,
	        buttons:[{
				text:'确定',
				handler:sendMsg
			},{
				text:'关闭',
				handler:closeSsendMsgWindow
			}]">
			<input type="hidden" value="-1" id="smd_id" />
			<input type="hidden" value="-1" id="smd_name" />
			<input type="hidden" value="-1" id="smd_sex" />
			<input type="hidden" value="-1" id="smd_phone" />
			<input type="hidden" value="-1" id="smd_email" />
			<input type="hidden" value="-1" id="smd_member" />
			<input type="hidden" value="-1" id="smd_number" />
			<table>
				<tr>
					<td>
						<textarea id="textarea_msg" cols="50" rows="10" style="margin: 0px; width: 461px; height: 218px; resize: none;" id="smd_area">请填写未通过审核的原因......</textarea>
					</td>
				</tr>
			</table>
		</div>
		
		<!-- 打开发送未通过消息对话框  ********* 结束-->
		
		<script>
		function formatterID(value,row,index){
			var down_pdf = "<a href='${request.contextPath}/admin/users/down/pdf?id="+ value +"'>协议书</a>&nbsp;";
			if(row.status == 0){
				return down_pdf + "|&nbsp;<a href='javascript:opneWindow("+ index +")'>审核</a>";
			}
			<#if sysAdmin.nickname == "admin">
				if(row.status == 2){
					return down_pdf + "|&nbsp;<a href='javascript:activeNumber("+ value +")'>激活</a>";
				}
			</#if>
			return down_pdf;
		}
		
		function formatterStatus(value,row,index){
			var _status = "";
			if(row.status == 0){
				_status = "待审核";
			}else if(row.status == 1){
				_status = "已审核，待激活";
			}else if(row.status == 2){
				_status = "已通过交易中心审核";
			}else if(row.status == 3){
				_status = "已入金激活";
			}
			return _status;
		}
		</script>
	</body>
</html>